//@author A0088797Y
#include "stdafx.h"
#include "CppUnitTest.h"

using namespace Microsoft::VisualStudio::CppUnitTestFramework;

using namespace std;

namespace UndoneClassTest
{		
	TEST_CLASS(UndoneUnitTests)
	{
	public:
		
		TEST_METHOD(UndoneSingleInvalidTaskIndexOutOfRange)
		{
			string input = "18";
			string expected = INPUTERROR_INVALIDTASKINDEXOUTOFRANGE;
			string feedback = "";

			string todoFileName = "testingTodo.txt";
			string doneFileName = "testingDone.txt";
			Manipulator* todoTMPtr;
			todoTMPtr = new TextManipulatorStub(todoFileName);
			Manipulator* doneTMPtr;
			doneTMPtr = new TextManipulatorStub(doneFileName);

			TestMethods test(todoTMPtr, doneTMPtr);
			Manipulator* displayedTMPtr = doneTMPtr;
			int displayedTasksIndexesArray[] = {0, 2, 7, 10};
			vector<int> displayedTasksIndexes(displayedTasksIndexesArray, displayedTasksIndexesArray + sizeof(displayedTasksIndexesArray)/sizeof(int));
			test.executeUpdateDisplayedTask(displayedTMPtr, displayedTasksIndexes);

			Undone u(todoTMPtr, doneTMPtr);

			try {
				feedback = u.executeInput(input);
			} catch(exception& exception) {
				feedback = exception.what();
			}

			Assert::AreEqual(expected, feedback);

			vector<Task> doneTaskVector;			
			doneTaskVector = doneTMPtr->read();

			Assert::AreEqual((unsigned int)18, doneTaskVector.size());
			Assert::AreEqual((string)"[F]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist", doneTaskVector[0].prepareLine());
			Assert::AreEqual((string)"[F]\tLearn guitar\t-\t-\t-", doneTaskVector[1].prepareLine());
			Assert::AreEqual((string)"[F]\tBring parents to Madives\t-\t-\t-", doneTaskVector[2].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t10/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[3].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t11/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[4].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t12/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[5].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t13/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[6].prepareLine());
			Assert::AreEqual((string)"[D]\tComplete Time Dilation Project\t-\t13/02/14 1200\t-", doneTaskVector[7].prepareLine());
			Assert::AreEqual((string)"[T]\tHair cut for Vday\t13/02/14 1500\t13/02/14 1700\tCubby House", doneTaskVector[8].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with Ex before Vday\t13/02/14 1900\t13/02/14 2300\tHotel Rendezous", doneTaskVector[9].prepareLine());
			Assert::AreEqual((string)"[D]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)", doneTaskVector[10].prepareLine());
			Assert::AreEqual((string)"[T]\tPacify wife\t14/02/14 0800\t14/02/14 1000\tin-law's place", doneTaskVector[11].prepareLine());
			Assert::AreEqual((string)"[P]\tMeet up with Gf till dunno what time\t14/02/14 1700\t-\tConcord Hotel", doneTaskVector[12].prepareLine());
			Assert::AreEqual((string)"[P]\tStart Revising for Exams\t15/02/14 0800\t-\t-", doneTaskVector[13].prepareLine());
			Assert::AreEqual((string)"[T]\tDo Time Dilation Project whenever I am free\t15/02/14 0800\t16/02/14 2359\t-", doneTaskVector[14].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with friends for dinner\t15/02/14 1700\t15/02/14 2100\tEverything with Fries", doneTaskVector[15].prepareLine());
			Assert::AreEqual((string)"[T]\tPARTY!!! TIME TO LET YOUR HAIR LOOSE\t15/02/14 2300\t16/02/14 0400\tZouk", doneTaskVector[16].prepareLine());
			Assert::AreEqual((string)"[P]\tTime to sleep\t16/02/14 0600\t-\t-", doneTaskVector[17].prepareLine());

			vector<Task> todoTaskVector;
			todoTaskVector = todoTMPtr->read();

			Assert::AreEqual((unsigned int)18, todoTaskVector.size());
			Assert::AreEqual((string)"[F]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist", todoTaskVector[0].prepareLine());
			Assert::AreEqual((string)"[F]\tLearn guitar\t-\t-\t-", todoTaskVector[1].prepareLine());
			Assert::AreEqual((string)"[F]\tBring parents to Madives\t-\t-\t-", todoTaskVector[2].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t10/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[3].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t11/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[4].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t12/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[5].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t13/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[6].prepareLine());
			Assert::AreEqual((string)"[D]\tComplete Time Dilation Project\t-\t13/02/14 1200\t-", todoTaskVector[7].prepareLine());
			Assert::AreEqual((string)"[T]\tHair cut for Vday\t13/02/14 1500\t13/02/14 1700\tCubby House", todoTaskVector[8].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with Ex before Vday\t13/02/14 1900\t13/02/14 2300\tHotel Rendezous", todoTaskVector[9].prepareLine());
			Assert::AreEqual((string)"[D]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)", todoTaskVector[10].prepareLine());
			Assert::AreEqual((string)"[T]\tPacify wife\t14/02/14 0800\t14/02/14 1000\tin-law's place", todoTaskVector[11].prepareLine());
			Assert::AreEqual((string)"[P]\tMeet up with Gf till dunno what time\t14/02/14 1700\t-\tConcord Hotel", todoTaskVector[12].prepareLine());
			Assert::AreEqual((string)"[P]\tStart Revising for Exams\t15/02/14 0800\t-\t-", todoTaskVector[13].prepareLine());
			Assert::AreEqual((string)"[T]\tDo Time Dilation Project whenever I am free\t15/02/14 0800\t16/02/14 2359\t-", todoTaskVector[14].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with friends for dinner\t15/02/14 1700\t15/02/14 2100\tEverything with Fries", todoTaskVector[15].prepareLine());
			Assert::AreEqual((string)"[T]\tPARTY!!! TIME TO LET YOUR HAIR LOOSE\t15/02/14 2300\t16/02/14 0400\tZouk", todoTaskVector[16].prepareLine());
			Assert::AreEqual((string)"[P]\tTime to sleep\t16/02/14 0600\t-\t-", todoTaskVector[17].prepareLine());

			delete todoTMPtr;
			delete doneTMPtr;
		}

		TEST_METHOD(UndoneMultipleInvalidTaskIndexOutOfRange)
		{
			string input = "2 7 10 18";
			string expected = INPUTERROR_INVALIDTASKINDEXOUTOFRANGE;
			string feedback = "";

			string todoFileName = "testingTodo.txt";
			string doneFileName = "testingDone.txt";
			Manipulator* todoTMPtr;
			todoTMPtr = new TextManipulatorStub(todoFileName);
			Manipulator* doneTMPtr;
			doneTMPtr = new TextManipulatorStub(doneFileName);

			TestMethods test(todoTMPtr, doneTMPtr);
			Manipulator* displayedTMPtr = doneTMPtr;
			int displayedTasksIndexesArray[] = {0, 2, 7, 10};
			vector<int> displayedTasksIndexes(displayedTasksIndexesArray, displayedTasksIndexesArray + sizeof(displayedTasksIndexesArray)/sizeof(int));
			test.executeUpdateDisplayedTask(displayedTMPtr, displayedTasksIndexes);

			Undone u(todoTMPtr, doneTMPtr);

			try {
				feedback = u.executeInput(input);
			} catch(exception& exception) {
				feedback = exception.what();
			}

			Assert::AreEqual(expected, feedback);

			vector<Task> doneTaskVector;			
			doneTaskVector = doneTMPtr->read();

			Assert::AreEqual((unsigned int)18, doneTaskVector.size());
			Assert::AreEqual((string)"[F]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist", doneTaskVector[0].prepareLine());
			Assert::AreEqual((string)"[F]\tLearn guitar\t-\t-\t-", doneTaskVector[1].prepareLine());
			Assert::AreEqual((string)"[F]\tBring parents to Madives\t-\t-\t-", doneTaskVector[2].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t10/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[3].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t11/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[4].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t12/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[5].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t13/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[6].prepareLine());
			Assert::AreEqual((string)"[D]\tComplete Time Dilation Project\t-\t13/02/14 1200\t-", doneTaskVector[7].prepareLine());
			Assert::AreEqual((string)"[T]\tHair cut for Vday\t13/02/14 1500\t13/02/14 1700\tCubby House", doneTaskVector[8].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with Ex before Vday\t13/02/14 1900\t13/02/14 2300\tHotel Rendezous", doneTaskVector[9].prepareLine());
			Assert::AreEqual((string)"[D]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)", doneTaskVector[10].prepareLine());
			Assert::AreEqual((string)"[T]\tPacify wife\t14/02/14 0800\t14/02/14 1000\tin-law's place", doneTaskVector[11].prepareLine());
			Assert::AreEqual((string)"[P]\tMeet up with Gf till dunno what time\t14/02/14 1700\t-\tConcord Hotel", doneTaskVector[12].prepareLine());
			Assert::AreEqual((string)"[P]\tStart Revising for Exams\t15/02/14 0800\t-\t-", doneTaskVector[13].prepareLine());
			Assert::AreEqual((string)"[T]\tDo Time Dilation Project whenever I am free\t15/02/14 0800\t16/02/14 2359\t-", doneTaskVector[14].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with friends for dinner\t15/02/14 1700\t15/02/14 2100\tEverything with Fries", doneTaskVector[15].prepareLine());
			Assert::AreEqual((string)"[T]\tPARTY!!! TIME TO LET YOUR HAIR LOOSE\t15/02/14 2300\t16/02/14 0400\tZouk", doneTaskVector[16].prepareLine());
			Assert::AreEqual((string)"[P]\tTime to sleep\t16/02/14 0600\t-\t-", doneTaskVector[17].prepareLine());

			vector<Task> todoTaskVector;
			todoTaskVector = todoTMPtr->read();

			Assert::AreEqual((unsigned int)18, todoTaskVector.size());
			Assert::AreEqual((string)"[F]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist", todoTaskVector[0].prepareLine());
			Assert::AreEqual((string)"[F]\tLearn guitar\t-\t-\t-", todoTaskVector[1].prepareLine());
			Assert::AreEqual((string)"[F]\tBring parents to Madives\t-\t-\t-", todoTaskVector[2].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t10/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[3].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t11/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[4].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t12/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[5].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t13/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[6].prepareLine());
			Assert::AreEqual((string)"[D]\tComplete Time Dilation Project\t-\t13/02/14 1200\t-", todoTaskVector[7].prepareLine());
			Assert::AreEqual((string)"[T]\tHair cut for Vday\t13/02/14 1500\t13/02/14 1700\tCubby House", todoTaskVector[8].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with Ex before Vday\t13/02/14 1900\t13/02/14 2300\tHotel Rendezous", todoTaskVector[9].prepareLine());
			Assert::AreEqual((string)"[D]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)", todoTaskVector[10].prepareLine());
			Assert::AreEqual((string)"[T]\tPacify wife\t14/02/14 0800\t14/02/14 1000\tin-law's place", todoTaskVector[11].prepareLine());
			Assert::AreEqual((string)"[P]\tMeet up with Gf till dunno what time\t14/02/14 1700\t-\tConcord Hotel", todoTaskVector[12].prepareLine());
			Assert::AreEqual((string)"[P]\tStart Revising for Exams\t15/02/14 0800\t-\t-", todoTaskVector[13].prepareLine());
			Assert::AreEqual((string)"[T]\tDo Time Dilation Project whenever I am free\t15/02/14 0800\t16/02/14 2359\t-", todoTaskVector[14].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with friends for dinner\t15/02/14 1700\t15/02/14 2100\tEverything with Fries", todoTaskVector[15].prepareLine());
			Assert::AreEqual((string)"[T]\tPARTY!!! TIME TO LET YOUR HAIR LOOSE\t15/02/14 2300\t16/02/14 0400\tZouk", todoTaskVector[16].prepareLine());
			Assert::AreEqual((string)"[P]\tTime to sleep\t16/02/14 0600\t-\t-", todoTaskVector[17].prepareLine());

			delete todoTMPtr;
			delete doneTMPtr;
		}

		TEST_METHOD(UndoneInvalidTaskIndexString)
		{
			string input = "testing invalid task index input parameters";
			string expected = INPUTERROR_INVALIDTASKINDEX;
			string feedback = "";

			string todoFileName = "testingTodo.txt";
			string doneFileName = "testingDone.txt";
			Manipulator* todoTMPtr;
			todoTMPtr = new TextManipulatorStub(todoFileName);
			Manipulator* doneTMPtr;
			doneTMPtr = new TextManipulatorStub(doneFileName);

			TestMethods test(todoTMPtr, doneTMPtr);
			Manipulator* displayedTMPtr = doneTMPtr;
			int displayedTasksIndexesArray[] = {0, 2, 7, 10};
			vector<int> displayedTasksIndexes(displayedTasksIndexesArray, displayedTasksIndexesArray + sizeof(displayedTasksIndexesArray)/sizeof(int));
			test.executeUpdateDisplayedTask(displayedTMPtr, displayedTasksIndexes);

			Undone u(todoTMPtr, doneTMPtr);

			try {
				feedback = u.executeInput(input);
			} catch(exception& exception) {
				feedback = exception.what();
			}

			Assert::AreEqual(expected, feedback);

			vector<Task> doneTaskVector;			
			doneTaskVector = doneTMPtr->read();

			Assert::AreEqual((unsigned int)18, doneTaskVector.size());
			Assert::AreEqual((string)"[F]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist", doneTaskVector[0].prepareLine());
			Assert::AreEqual((string)"[F]\tLearn guitar\t-\t-\t-", doneTaskVector[1].prepareLine());
			Assert::AreEqual((string)"[F]\tBring parents to Madives\t-\t-\t-", doneTaskVector[2].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t10/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[3].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t11/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[4].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t12/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[5].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t13/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[6].prepareLine());
			Assert::AreEqual((string)"[D]\tComplete Time Dilation Project\t-\t13/02/14 1200\t-", doneTaskVector[7].prepareLine());
			Assert::AreEqual((string)"[T]\tHair cut for Vday\t13/02/14 1500\t13/02/14 1700\tCubby House", doneTaskVector[8].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with Ex before Vday\t13/02/14 1900\t13/02/14 2300\tHotel Rendezous", doneTaskVector[9].prepareLine());
			Assert::AreEqual((string)"[D]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)", doneTaskVector[10].prepareLine());
			Assert::AreEqual((string)"[T]\tPacify wife\t14/02/14 0800\t14/02/14 1000\tin-law's place", doneTaskVector[11].prepareLine());
			Assert::AreEqual((string)"[P]\tMeet up with Gf till dunno what time\t14/02/14 1700\t-\tConcord Hotel", doneTaskVector[12].prepareLine());
			Assert::AreEqual((string)"[P]\tStart Revising for Exams\t15/02/14 0800\t-\t-", doneTaskVector[13].prepareLine());
			Assert::AreEqual((string)"[T]\tDo Time Dilation Project whenever I am free\t15/02/14 0800\t16/02/14 2359\t-", doneTaskVector[14].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with friends for dinner\t15/02/14 1700\t15/02/14 2100\tEverything with Fries", doneTaskVector[15].prepareLine());
			Assert::AreEqual((string)"[T]\tPARTY!!! TIME TO LET YOUR HAIR LOOSE\t15/02/14 2300\t16/02/14 0400\tZouk", doneTaskVector[16].prepareLine());
			Assert::AreEqual((string)"[P]\tTime to sleep\t16/02/14 0600\t-\t-", doneTaskVector[17].prepareLine());

			vector<Task> todoTaskVector;
			todoTaskVector = todoTMPtr->read();

			Assert::AreEqual((unsigned int)18, todoTaskVector.size());
			Assert::AreEqual((string)"[F]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist", todoTaskVector[0].prepareLine());
			Assert::AreEqual((string)"[F]\tLearn guitar\t-\t-\t-", todoTaskVector[1].prepareLine());
			Assert::AreEqual((string)"[F]\tBring parents to Madives\t-\t-\t-", todoTaskVector[2].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t10/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[3].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t11/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[4].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t12/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[5].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t13/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[6].prepareLine());
			Assert::AreEqual((string)"[D]\tComplete Time Dilation Project\t-\t13/02/14 1200\t-", todoTaskVector[7].prepareLine());
			Assert::AreEqual((string)"[T]\tHair cut for Vday\t13/02/14 1500\t13/02/14 1700\tCubby House", todoTaskVector[8].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with Ex before Vday\t13/02/14 1900\t13/02/14 2300\tHotel Rendezous", todoTaskVector[9].prepareLine());
			Assert::AreEqual((string)"[D]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)", todoTaskVector[10].prepareLine());
			Assert::AreEqual((string)"[T]\tPacify wife\t14/02/14 0800\t14/02/14 1000\tin-law's place", todoTaskVector[11].prepareLine());
			Assert::AreEqual((string)"[P]\tMeet up with Gf till dunno what time\t14/02/14 1700\t-\tConcord Hotel", todoTaskVector[12].prepareLine());
			Assert::AreEqual((string)"[P]\tStart Revising for Exams\t15/02/14 0800\t-\t-", todoTaskVector[13].prepareLine());
			Assert::AreEqual((string)"[T]\tDo Time Dilation Project whenever I am free\t15/02/14 0800\t16/02/14 2359\t-", todoTaskVector[14].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with friends for dinner\t15/02/14 1700\t15/02/14 2100\tEverything with Fries", todoTaskVector[15].prepareLine());
			Assert::AreEqual((string)"[T]\tPARTY!!! TIME TO LET YOUR HAIR LOOSE\t15/02/14 2300\t16/02/14 0400\tZouk", todoTaskVector[16].prepareLine());
			Assert::AreEqual((string)"[P]\tTime to sleep\t16/02/14 0600\t-\t-", todoTaskVector[17].prepareLine());

			delete todoTMPtr;
			delete doneTMPtr;
		}

		TEST_METHOD(UndoneInvalidTaskIndexStringAndInt)
		{
			string input = "0 testing invalid task index input parameters";
			string expected = INPUTERROR_INVALIDTASKINDEX;
			string feedback = "";

			string todoFileName = "testingTodo.txt";
			string doneFileName = "testingDone.txt";
			Manipulator* todoTMPtr;
			todoTMPtr = new TextManipulatorStub(todoFileName);
			Manipulator* doneTMPtr;
			doneTMPtr = new TextManipulatorStub(doneFileName);

			TestMethods test(todoTMPtr, doneTMPtr);
			Manipulator* displayedTMPtr = doneTMPtr;
			int displayedTasksIndexesArray[] = {0, 2, 7, 10};
			vector<int> displayedTasksIndexes(displayedTasksIndexesArray, displayedTasksIndexesArray + sizeof(displayedTasksIndexesArray)/sizeof(int));
			test.executeUpdateDisplayedTask(displayedTMPtr, displayedTasksIndexes);

			Undone u(todoTMPtr, doneTMPtr);

			try {
				feedback = u.executeInput(input);
			} catch(exception& exception) {
				feedback = exception.what();
			}

			Assert::AreEqual(expected, feedback);

			vector<Task> doneTaskVector;			
			doneTaskVector = doneTMPtr->read();

			Assert::AreEqual((unsigned int)18, doneTaskVector.size());
			Assert::AreEqual((string)"[F]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist", doneTaskVector[0].prepareLine());
			Assert::AreEqual((string)"[F]\tLearn guitar\t-\t-\t-", doneTaskVector[1].prepareLine());
			Assert::AreEqual((string)"[F]\tBring parents to Madives\t-\t-\t-", doneTaskVector[2].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t10/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[3].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t11/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[4].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t12/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[5].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t13/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[6].prepareLine());
			Assert::AreEqual((string)"[D]\tComplete Time Dilation Project\t-\t13/02/14 1200\t-", doneTaskVector[7].prepareLine());
			Assert::AreEqual((string)"[T]\tHair cut for Vday\t13/02/14 1500\t13/02/14 1700\tCubby House", doneTaskVector[8].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with Ex before Vday\t13/02/14 1900\t13/02/14 2300\tHotel Rendezous", doneTaskVector[9].prepareLine());
			Assert::AreEqual((string)"[D]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)", doneTaskVector[10].prepareLine());
			Assert::AreEqual((string)"[T]\tPacify wife\t14/02/14 0800\t14/02/14 1000\tin-law's place", doneTaskVector[11].prepareLine());
			Assert::AreEqual((string)"[P]\tMeet up with Gf till dunno what time\t14/02/14 1700\t-\tConcord Hotel", doneTaskVector[12].prepareLine());
			Assert::AreEqual((string)"[P]\tStart Revising for Exams\t15/02/14 0800\t-\t-", doneTaskVector[13].prepareLine());
			Assert::AreEqual((string)"[T]\tDo Time Dilation Project whenever I am free\t15/02/14 0800\t16/02/14 2359\t-", doneTaskVector[14].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with friends for dinner\t15/02/14 1700\t15/02/14 2100\tEverything with Fries", doneTaskVector[15].prepareLine());
			Assert::AreEqual((string)"[T]\tPARTY!!! TIME TO LET YOUR HAIR LOOSE\t15/02/14 2300\t16/02/14 0400\tZouk", doneTaskVector[16].prepareLine());
			Assert::AreEqual((string)"[P]\tTime to sleep\t16/02/14 0600\t-\t-", doneTaskVector[17].prepareLine());

			vector<Task> todoTaskVector;
			todoTaskVector = todoTMPtr->read();

			Assert::AreEqual((unsigned int)18, todoTaskVector.size());
			Assert::AreEqual((string)"[F]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist", todoTaskVector[0].prepareLine());
			Assert::AreEqual((string)"[F]\tLearn guitar\t-\t-\t-", todoTaskVector[1].prepareLine());
			Assert::AreEqual((string)"[F]\tBring parents to Madives\t-\t-\t-", todoTaskVector[2].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t10/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[3].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t11/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[4].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t12/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[5].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t13/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[6].prepareLine());
			Assert::AreEqual((string)"[D]\tComplete Time Dilation Project\t-\t13/02/14 1200\t-", todoTaskVector[7].prepareLine());
			Assert::AreEqual((string)"[T]\tHair cut for Vday\t13/02/14 1500\t13/02/14 1700\tCubby House", todoTaskVector[8].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with Ex before Vday\t13/02/14 1900\t13/02/14 2300\tHotel Rendezous", todoTaskVector[9].prepareLine());
			Assert::AreEqual((string)"[D]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)", todoTaskVector[10].prepareLine());
			Assert::AreEqual((string)"[T]\tPacify wife\t14/02/14 0800\t14/02/14 1000\tin-law's place", todoTaskVector[11].prepareLine());
			Assert::AreEqual((string)"[P]\tMeet up with Gf till dunno what time\t14/02/14 1700\t-\tConcord Hotel", todoTaskVector[12].prepareLine());
			Assert::AreEqual((string)"[P]\tStart Revising for Exams\t15/02/14 0800\t-\t-", todoTaskVector[13].prepareLine());
			Assert::AreEqual((string)"[T]\tDo Time Dilation Project whenever I am free\t15/02/14 0800\t16/02/14 2359\t-", todoTaskVector[14].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with friends for dinner\t15/02/14 1700\t15/02/14 2100\tEverything with Fries", todoTaskVector[15].prepareLine());
			Assert::AreEqual((string)"[T]\tPARTY!!! TIME TO LET YOUR HAIR LOOSE\t15/02/14 2300\t16/02/14 0400\tZouk", todoTaskVector[16].prepareLine());
			Assert::AreEqual((string)"[P]\tTime to sleep\t16/02/14 0600\t-\t-", todoTaskVector[17].prepareLine());

			delete todoTMPtr;
			delete doneTMPtr;
		}
		
		TEST_METHOD(UndoneOne)
		{
			string input = "7";
			string expected = "Marked the following undone:\nDEADLINE (7): Thu, 13 Feb 2014, 12:00PM: Complete Time Dilation Project\n";
		
			string feedback = "";

			string todoFileName = "testingTodo.txt";
			string doneFileName = "testingDone.txt";
			Manipulator* todoTMPtr;
			todoTMPtr = new TextManipulatorStub(todoFileName);
			Manipulator* doneTMPtr;
			doneTMPtr = new TextManipulatorStub(doneFileName);

			TestMethods test(todoTMPtr, doneTMPtr);
			Manipulator* displayedTMPtr = doneTMPtr;
			int displayedTasksIndexesArray[] = {0, 2, 7, 10};
			vector<int> displayedTasksIndexes(displayedTasksIndexesArray, displayedTasksIndexesArray + sizeof(displayedTasksIndexesArray)/sizeof(int));
			test.executeUpdateDisplayedTask(displayedTMPtr, displayedTasksIndexes);

			Undone u(todoTMPtr, doneTMPtr);

			try {
				feedback = u.executeInput(input);
			} catch(exception& exception) {
				feedback = exception.what();
			}

			Assert::AreEqual(expected, feedback);

			vector<Task> doneTaskVector;			
			doneTaskVector = doneTMPtr->read();

			Assert::AreEqual((unsigned int)18, doneTaskVector.size());
			Assert::AreEqual((string)"[F]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist", doneTaskVector[0].prepareLine());
			Assert::AreEqual((string)"[F]\tLearn guitar\t-\t-\t-", doneTaskVector[1].prepareLine());
			Assert::AreEqual((string)"[F]\tBring parents to Madives\t-\t-\t-", doneTaskVector[2].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t10/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[3].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t11/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[4].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t12/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[5].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t13/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[6].prepareLine());
			Assert::AreEqual((string)"[I]\tComplete Time Dilation Project\t-\t13/02/14 1200\t-", doneTaskVector[7].prepareLine());
			Assert::AreEqual((string)"[T]\tHair cut for Vday\t13/02/14 1500\t13/02/14 1700\tCubby House", doneTaskVector[8].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with Ex before Vday\t13/02/14 1900\t13/02/14 2300\tHotel Rendezous", doneTaskVector[9].prepareLine());
			Assert::AreEqual((string)"[D]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)", doneTaskVector[10].prepareLine());
			Assert::AreEqual((string)"[T]\tPacify wife\t14/02/14 0800\t14/02/14 1000\tin-law's place", doneTaskVector[11].prepareLine());
			Assert::AreEqual((string)"[P]\tMeet up with Gf till dunno what time\t14/02/14 1700\t-\tConcord Hotel", doneTaskVector[12].prepareLine());
			Assert::AreEqual((string)"[P]\tStart Revising for Exams\t15/02/14 0800\t-\t-", doneTaskVector[13].prepareLine());
			Assert::AreEqual((string)"[T]\tDo Time Dilation Project whenever I am free\t15/02/14 0800\t16/02/14 2359\t-", doneTaskVector[14].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with friends for dinner\t15/02/14 1700\t15/02/14 2100\tEverything with Fries", doneTaskVector[15].prepareLine());
			Assert::AreEqual((string)"[T]\tPARTY!!! TIME TO LET YOUR HAIR LOOSE\t15/02/14 2300\t16/02/14 0400\tZouk", doneTaskVector[16].prepareLine());
			Assert::AreEqual((string)"[P]\tTime to sleep\t16/02/14 0600\t-\t-", doneTaskVector[17].prepareLine());
		
			vector<Task> todoTaskVector;
			todoTaskVector = todoTMPtr->read();

			Assert::AreEqual((unsigned int)19, todoTaskVector.size());
			Assert::AreEqual((string)"[F]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist", todoTaskVector[0].prepareLine());
			Assert::AreEqual((string)"[F]\tLearn guitar\t-\t-\t-", todoTaskVector[1].prepareLine());
			Assert::AreEqual((string)"[F]\tBring parents to Madives\t-\t-\t-", todoTaskVector[2].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t10/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[3].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t11/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[4].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t12/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[5].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t13/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[6].prepareLine());
			Assert::AreEqual((string)"[D]\tComplete Time Dilation Project\t-\t13/02/14 1200\t-", todoTaskVector[7].prepareLine());
			Assert::AreEqual((string)"[T]\tHair cut for Vday\t13/02/14 1500\t13/02/14 1700\tCubby House", todoTaskVector[8].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with Ex before Vday\t13/02/14 1900\t13/02/14 2300\tHotel Rendezous", todoTaskVector[9].prepareLine());
			Assert::AreEqual((string)"[D]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)", todoTaskVector[10].prepareLine());
			Assert::AreEqual((string)"[T]\tPacify wife\t14/02/14 0800\t14/02/14 1000\tin-law's place", todoTaskVector[11].prepareLine());
			Assert::AreEqual((string)"[P]\tMeet up with Gf till dunno what time\t14/02/14 1700\t-\tConcord Hotel", todoTaskVector[12].prepareLine());
			Assert::AreEqual((string)"[P]\tStart Revising for Exams\t15/02/14 0800\t-\t-", todoTaskVector[13].prepareLine());
			Assert::AreEqual((string)"[T]\tDo Time Dilation Project whenever I am free\t15/02/14 0800\t16/02/14 2359\t-", todoTaskVector[14].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with friends for dinner\t15/02/14 1700\t15/02/14 2100\tEverything with Fries", todoTaskVector[15].prepareLine());
			Assert::AreEqual((string)"[T]\tPARTY!!! TIME TO LET YOUR HAIR LOOSE\t15/02/14 2300\t16/02/14 0400\tZouk", todoTaskVector[16].prepareLine());
			Assert::AreEqual((string)"[P]\tTime to sleep\t16/02/14 0600\t-\t-", todoTaskVector[17].prepareLine());
			Assert::AreEqual((string)"[D]\tComplete Time Dilation Project\t-\t13/02/14 1200\t-", todoTaskVector[18].prepareLine());

			delete todoTMPtr;
			delete doneTMPtr;
		}

		TEST_METHOD(UndoneMultipleAndDoneAlreadyDone)
		{
			string input = "0 2 10";
			string expected = "Marked the following undone:\nTO-DO (0): Buy flowers for valentine's day; Clementi MRT florist\nTO-DO (2): Bring parents to Madives\nDEADLINE (10): Fri, 14 Feb 2014, 12:00AM: Order Lambogini for valentine; Lamborghini showroom - 30 Tebans Gardens Crescent S(608927)\n";
			string feedback = "";

			string todoFileName = "testingTodo.txt";
			string doneFileName = "testingDone.txt";
			Manipulator* todoTMPtr;
			todoTMPtr = new TextManipulatorStub(todoFileName);
			Manipulator* doneTMPtr;
			doneTMPtr = new TextManipulatorStub(doneFileName);

			TestMethods test(todoTMPtr, doneTMPtr);
			Manipulator* displayedTMPtr = doneTMPtr;
			int displayedTasksIndexesArray[] = {0, 2, 7, 10};
			vector<int> displayedTasksIndexes(displayedTasksIndexesArray, displayedTasksIndexesArray + sizeof(displayedTasksIndexesArray)/sizeof(int));
			test.executeUpdateDisplayedTask(displayedTMPtr, displayedTasksIndexes);

			Undone u(todoTMPtr, doneTMPtr);

			try {
				feedback = u.executeInput(input);
			} catch(exception& exception) {
				feedback = exception.what();
			}

			Assert::AreEqual(expected, feedback);

			vector<Task> doneTaskVector;			
			doneTaskVector = doneTMPtr->read();

			Assert::AreEqual((unsigned int)18, doneTaskVector.size());
			Assert::AreEqual((string)"[I]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist", doneTaskVector[0].prepareLine());
			Assert::AreEqual((string)"[F]\tLearn guitar\t-\t-\t-", doneTaskVector[1].prepareLine());
			Assert::AreEqual((string)"[I]\tBring parents to Madives\t-\t-\t-", doneTaskVector[2].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t10/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[3].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t11/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[4].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t12/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[5].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t13/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[6].prepareLine());
			Assert::AreEqual((string)"[D]\tComplete Time Dilation Project\t-\t13/02/14 1200\t-", doneTaskVector[7].prepareLine());
			Assert::AreEqual((string)"[T]\tHair cut for Vday\t13/02/14 1500\t13/02/14 1700\tCubby House", doneTaskVector[8].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with Ex before Vday\t13/02/14 1900\t13/02/14 2300\tHotel Rendezous", doneTaskVector[9].prepareLine());
			Assert::AreEqual((string)"[I]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)", doneTaskVector[10].prepareLine());
			Assert::AreEqual((string)"[T]\tPacify wife\t14/02/14 0800\t14/02/14 1000\tin-law's place", doneTaskVector[11].prepareLine());
			Assert::AreEqual((string)"[P]\tMeet up with Gf till dunno what time\t14/02/14 1700\t-\tConcord Hotel", doneTaskVector[12].prepareLine());
			Assert::AreEqual((string)"[P]\tStart Revising for Exams\t15/02/14 0800\t-\t-", doneTaskVector[13].prepareLine());
			Assert::AreEqual((string)"[T]\tDo Time Dilation Project whenever I am free\t15/02/14 0800\t16/02/14 2359\t-", doneTaskVector[14].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with friends for dinner\t15/02/14 1700\t15/02/14 2100\tEverything with Fries", doneTaskVector[15].prepareLine());
			Assert::AreEqual((string)"[T]\tPARTY!!! TIME TO LET YOUR HAIR LOOSE\t15/02/14 2300\t16/02/14 0400\tZouk", doneTaskVector[16].prepareLine());
			Assert::AreEqual((string)"[P]\tTime to sleep\t16/02/14 0600\t-\t-", doneTaskVector[17].prepareLine());
		
			vector<Task> todoTaskVector;
			todoTaskVector = todoTMPtr->read();

			Assert::AreEqual((unsigned int)21, todoTaskVector.size());
			Assert::AreEqual((string)"[F]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist", todoTaskVector[0].prepareLine());
			Assert::AreEqual((string)"[F]\tLearn guitar\t-\t-\t-", todoTaskVector[1].prepareLine());
			Assert::AreEqual((string)"[F]\tBring parents to Madives\t-\t-\t-", todoTaskVector[2].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t10/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[3].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t11/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[4].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t12/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[5].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t13/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[6].prepareLine());
			Assert::AreEqual((string)"[D]\tComplete Time Dilation Project\t-\t13/02/14 1200\t-", todoTaskVector[7].prepareLine());
			Assert::AreEqual((string)"[T]\tHair cut for Vday\t13/02/14 1500\t13/02/14 1700\tCubby House", todoTaskVector[8].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with Ex before Vday\t13/02/14 1900\t13/02/14 2300\tHotel Rendezous", todoTaskVector[9].prepareLine());
			Assert::AreEqual((string)"[D]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)", todoTaskVector[10].prepareLine());
			Assert::AreEqual((string)"[T]\tPacify wife\t14/02/14 0800\t14/02/14 1000\tin-law's place", todoTaskVector[11].prepareLine());
			Assert::AreEqual((string)"[P]\tMeet up with Gf till dunno what time\t14/02/14 1700\t-\tConcord Hotel", todoTaskVector[12].prepareLine());
			Assert::AreEqual((string)"[P]\tStart Revising for Exams\t15/02/14 0800\t-\t-", todoTaskVector[13].prepareLine());
			Assert::AreEqual((string)"[T]\tDo Time Dilation Project whenever I am free\t15/02/14 0800\t16/02/14 2359\t-", todoTaskVector[14].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with friends for dinner\t15/02/14 1700\t15/02/14 2100\tEverything with Fries", todoTaskVector[15].prepareLine());
			Assert::AreEqual((string)"[T]\tPARTY!!! TIME TO LET YOUR HAIR LOOSE\t15/02/14 2300\t16/02/14 0400\tZouk", todoTaskVector[16].prepareLine());
			Assert::AreEqual((string)"[P]\tTime to sleep\t16/02/14 0600\t-\t-", todoTaskVector[17].prepareLine());
			Assert::AreEqual((string)"[F]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist", todoTaskVector[18].prepareLine());
			Assert::AreEqual((string)"[F]\tBring parents to Madives\t-\t-\t-", todoTaskVector[19].prepareLine());
			Assert::AreEqual((string)"[D]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)", todoTaskVector[20].prepareLine());

			input = "2";
			expected = INPUTERROR_TASKALREADYREMOVED;
			
			try {
				feedback = u.executeInput(input);
			} catch(exception& exception) {
				feedback = exception.what();
			}

			Assert::AreEqual(expected, feedback);
		
			doneTaskVector = doneTMPtr->read();

			Assert::AreEqual((unsigned int)18, doneTaskVector.size());
			Assert::AreEqual((string)"[I]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist", doneTaskVector[0].prepareLine());
			Assert::AreEqual((string)"[F]\tLearn guitar\t-\t-\t-", doneTaskVector[1].prepareLine());
			Assert::AreEqual((string)"[I]\tBring parents to Madives\t-\t-\t-", doneTaskVector[2].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t10/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[3].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t11/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[4].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t12/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[5].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t13/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[6].prepareLine());
			Assert::AreEqual((string)"[D]\tComplete Time Dilation Project\t-\t13/02/14 1200\t-", doneTaskVector[7].prepareLine());
			Assert::AreEqual((string)"[T]\tHair cut for Vday\t13/02/14 1500\t13/02/14 1700\tCubby House", doneTaskVector[8].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with Ex before Vday\t13/02/14 1900\t13/02/14 2300\tHotel Rendezous", doneTaskVector[9].prepareLine());
			Assert::AreEqual((string)"[I]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)", doneTaskVector[10].prepareLine());
			Assert::AreEqual((string)"[T]\tPacify wife\t14/02/14 0800\t14/02/14 1000\tin-law's place", doneTaskVector[11].prepareLine());
			Assert::AreEqual((string)"[P]\tMeet up with Gf till dunno what time\t14/02/14 1700\t-\tConcord Hotel", doneTaskVector[12].prepareLine());
			Assert::AreEqual((string)"[P]\tStart Revising for Exams\t15/02/14 0800\t-\t-", doneTaskVector[13].prepareLine());
			Assert::AreEqual((string)"[T]\tDo Time Dilation Project whenever I am free\t15/02/14 0800\t16/02/14 2359\t-", doneTaskVector[14].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with friends for dinner\t15/02/14 1700\t15/02/14 2100\tEverything with Fries", doneTaskVector[15].prepareLine());
			Assert::AreEqual((string)"[T]\tPARTY!!! TIME TO LET YOUR HAIR LOOSE\t15/02/14 2300\t16/02/14 0400\tZouk", doneTaskVector[16].prepareLine());
			Assert::AreEqual((string)"[P]\tTime to sleep\t16/02/14 0600\t-\t-", doneTaskVector[17].prepareLine());
		
			todoTaskVector = todoTMPtr->read();

			Assert::AreEqual((unsigned int)21, todoTaskVector.size());
			Assert::AreEqual((string)"[F]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist", todoTaskVector[0].prepareLine());
			Assert::AreEqual((string)"[F]\tLearn guitar\t-\t-\t-", todoTaskVector[1].prepareLine());
			Assert::AreEqual((string)"[F]\tBring parents to Madives\t-\t-\t-", todoTaskVector[2].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t10/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[3].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t11/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[4].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t12/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[5].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t13/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[6].prepareLine());
			Assert::AreEqual((string)"[D]\tComplete Time Dilation Project\t-\t13/02/14 1200\t-", todoTaskVector[7].prepareLine());
			Assert::AreEqual((string)"[T]\tHair cut for Vday\t13/02/14 1500\t13/02/14 1700\tCubby House", todoTaskVector[8].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with Ex before Vday\t13/02/14 1900\t13/02/14 2300\tHotel Rendezous", todoTaskVector[9].prepareLine());
			Assert::AreEqual((string)"[D]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)", todoTaskVector[10].prepareLine());
			Assert::AreEqual((string)"[T]\tPacify wife\t14/02/14 0800\t14/02/14 1000\tin-law's place", todoTaskVector[11].prepareLine());
			Assert::AreEqual((string)"[P]\tMeet up with Gf till dunno what time\t14/02/14 1700\t-\tConcord Hotel", todoTaskVector[12].prepareLine());
			Assert::AreEqual((string)"[P]\tStart Revising for Exams\t15/02/14 0800\t-\t-", todoTaskVector[13].prepareLine());
			Assert::AreEqual((string)"[T]\tDo Time Dilation Project whenever I am free\t15/02/14 0800\t16/02/14 2359\t-", todoTaskVector[14].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with friends for dinner\t15/02/14 1700\t15/02/14 2100\tEverything with Fries", todoTaskVector[15].prepareLine());
			Assert::AreEqual((string)"[T]\tPARTY!!! TIME TO LET YOUR HAIR LOOSE\t15/02/14 2300\t16/02/14 0400\tZouk", todoTaskVector[16].prepareLine());
			Assert::AreEqual((string)"[P]\tTime to sleep\t16/02/14 0600\t-\t-", todoTaskVector[17].prepareLine());
			Assert::AreEqual((string)"[F]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist", todoTaskVector[18].prepareLine());
			Assert::AreEqual((string)"[F]\tBring parents to Madives\t-\t-\t-", todoTaskVector[19].prepareLine());
			Assert::AreEqual((string)"[D]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)", todoTaskVector[20].prepareLine());

			delete todoTMPtr;
			delete doneTMPtr;
		}

		TEST_METHOD(UndoneInvalidDisplayedTasks)
		{
			string input = "0";
			string expected = INPUTERROR_INVALIDUNDONEDISPLAYEDTASKS;
			string feedback = "";

			string todoFileName = "testingTodo.txt";
			string doneFileName = "testingDone.txt";
			Manipulator* todoTMPtr;
			todoTMPtr = new TextManipulatorStub(todoFileName);
			Manipulator* doneTMPtr;
			doneTMPtr = new TextManipulatorStub(doneFileName);

			TestMethods test(todoTMPtr, doneTMPtr);
			Manipulator* displayedTMPtr = todoTMPtr;
			int displayedTasksIndexesArray[] = {0, 2, 7, 10};
			vector<int> displayedTasksIndexes(displayedTasksIndexesArray, displayedTasksIndexesArray + sizeof(displayedTasksIndexesArray)/sizeof(int));
			test.executeUpdateDisplayedTask(displayedTMPtr, displayedTasksIndexes);

			Undone u(todoTMPtr, doneTMPtr);

			try {
				feedback = u.executeInput(input);
			} catch(exception& exception) {
				feedback = exception.what();
			}

			Assert::AreEqual(expected, feedback);

			vector<Task> doneTaskVector;			
			doneTaskVector = doneTMPtr->read();

			Assert::AreEqual((unsigned int)18, doneTaskVector.size());
			Assert::AreEqual((string)"[F]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist", doneTaskVector[0].prepareLine());
			Assert::AreEqual((string)"[F]\tLearn guitar\t-\t-\t-", doneTaskVector[1].prepareLine());
			Assert::AreEqual((string)"[F]\tBring parents to Madives\t-\t-\t-", doneTaskVector[2].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t10/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[3].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t11/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[4].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t12/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[5].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t13/02/14 0800\t13/02/14 1200\tGoogle Inc", doneTaskVector[6].prepareLine());
			Assert::AreEqual((string)"[D]\tComplete Time Dilation Project\t-\t13/02/14 1200\t-", doneTaskVector[7].prepareLine());
			Assert::AreEqual((string)"[T]\tHair cut for Vday\t13/02/14 1500\t13/02/14 1700\tCubby House", doneTaskVector[8].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with Ex before Vday\t13/02/14 1900\t13/02/14 2300\tHotel Rendezous", doneTaskVector[9].prepareLine());
			Assert::AreEqual((string)"[D]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)", doneTaskVector[10].prepareLine());
			Assert::AreEqual((string)"[T]\tPacify wife\t14/02/14 0800\t14/02/14 1000\tin-law's place", doneTaskVector[11].prepareLine());
			Assert::AreEqual((string)"[P]\tMeet up with Gf till dunno what time\t14/02/14 1700\t-\tConcord Hotel", doneTaskVector[12].prepareLine());
			Assert::AreEqual((string)"[P]\tStart Revising for Exams\t15/02/14 0800\t-\t-", doneTaskVector[13].prepareLine());
			Assert::AreEqual((string)"[T]\tDo Time Dilation Project whenever I am free\t15/02/14 0800\t16/02/14 2359\t-", doneTaskVector[14].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with friends for dinner\t15/02/14 1700\t15/02/14 2100\tEverything with Fries", doneTaskVector[15].prepareLine());
			Assert::AreEqual((string)"[T]\tPARTY!!! TIME TO LET YOUR HAIR LOOSE\t15/02/14 2300\t16/02/14 0400\tZouk", doneTaskVector[16].prepareLine());
			Assert::AreEqual((string)"[P]\tTime to sleep\t16/02/14 0600\t-\t-", doneTaskVector[17].prepareLine());

			vector<Task> todoTaskVector;
			todoTaskVector = todoTMPtr->read();

			Assert::AreEqual((unsigned int)18, todoTaskVector.size());
			Assert::AreEqual((string)"[F]\tBuy flowers for valentine's day\t-\t-\tClementi MRT florist", todoTaskVector[0].prepareLine());
			Assert::AreEqual((string)"[F]\tLearn guitar\t-\t-\t-", todoTaskVector[1].prepareLine());
			Assert::AreEqual((string)"[F]\tBring parents to Madives\t-\t-\t-", todoTaskVector[2].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t10/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[3].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t11/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[4].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t12/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[5].prepareLine());
			Assert::AreEqual((string)"[T]\tWorking part time\t13/02/14 0800\t13/02/14 1200\tGoogle Inc", todoTaskVector[6].prepareLine());
			Assert::AreEqual((string)"[D]\tComplete Time Dilation Project\t-\t13/02/14 1200\t-", todoTaskVector[7].prepareLine());
			Assert::AreEqual((string)"[T]\tHair cut for Vday\t13/02/14 1500\t13/02/14 1700\tCubby House", todoTaskVector[8].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with Ex before Vday\t13/02/14 1900\t13/02/14 2300\tHotel Rendezous", todoTaskVector[9].prepareLine());
			Assert::AreEqual((string)"[D]\tOrder Lambogini for valentine\t-\t14/02/14 0000\tLamborghini showroom - 30 Tebans Gardens Crescent S(608927)", todoTaskVector[10].prepareLine());
			Assert::AreEqual((string)"[T]\tPacify wife\t14/02/14 0800\t14/02/14 1000\tin-law's place", todoTaskVector[11].prepareLine());
			Assert::AreEqual((string)"[P]\tMeet up with Gf till dunno what time\t14/02/14 1700\t-\tConcord Hotel", todoTaskVector[12].prepareLine());
			Assert::AreEqual((string)"[P]\tStart Revising for Exams\t15/02/14 0800\t-\t-", todoTaskVector[13].prepareLine());
			Assert::AreEqual((string)"[T]\tDo Time Dilation Project whenever I am free\t15/02/14 0800\t16/02/14 2359\t-", todoTaskVector[14].prepareLine());
			Assert::AreEqual((string)"[T]\tMeet up with friends for dinner\t15/02/14 1700\t15/02/14 2100\tEverything with Fries", todoTaskVector[15].prepareLine());
			Assert::AreEqual((string)"[T]\tPARTY!!! TIME TO LET YOUR HAIR LOOSE\t15/02/14 2300\t16/02/14 0400\tZouk", todoTaskVector[16].prepareLine());
			Assert::AreEqual((string)"[P]\tTime to sleep\t16/02/14 0600\t-\t-", todoTaskVector[17].prepareLine());

			delete todoTMPtr;
			delete doneTMPtr;
		}

	};
}